package cn.edu.shengda;


interface ShapeArea{
    
    double getArea();
    
    double getPerimeter();
}

class Rectangle implements ShapeArea{

    double width;

    double height;

    public Rectangle(double w, double h){

        this.width=w;

        this.height=h;


    }


    @Override
    public String toString(){

        String s="width="+this.width+"\n";

        s+="Height="+this.height+"\n";

        s+="Perimeter="+this.getPerimeter()+"\n";

        s+="Area="+this.getArea()+"\n";

        return s;

    }


    @Override
    public double getPerimeter(){

        return 2*(width+height);

    }


    @Override
    public double getArea(){

        return height*width;

    }

}
class Circle implements ShapeArea{
    double radius;
    
    Circle(double r){
        
        radius=r;
        
    }
    
    public double getArea() {
        
        return 3.14*radius*radius;
        
    }
    
    public double getPerimeter()
            
    {
        
        return 2*3.14*radius;
        
    }
    
    public String toString() {
        
        return "radius="+radius+",perimeter="+getPerimeter()+",area="+getArea();
        
    }
}


public class Test{

    public static void main(String args[]){

//        if(args.length<2){
////        System.out.println("请在命令行输入两参数！");}
////
////        double width=Integer.parseInt(args[0]);
////        
////        double height=Integer.parseInt(args[1]);
        
        Rectangle rec=new Rectangle(10,5);
        
        System.out.println("该矩形的信息如下：");
        
        System.out.println(rec);
        
        Circle c=new Circle(1.0);

        System.out.println(c.toString());

    }

}
